package com.oymn.myapplication.adapter;

import android.graphics.Bitmap;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.oymn.myapplication.page.Fragment1;
import com.oymn.myapplication.page.Fragment2;
import com.oymn.myapplication.page.Fragment3;

public class MyFragmentStateAdapter extends FragmentStateAdapter {

    private Bitmap bitmap = null;

    public MyFragmentStateAdapter(@NonNull FragmentActivity fragmentActivity, Bitmap bitmap) {
        super(fragmentActivity);
        this.bitmap = bitmap;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        switch(position) {
            case 0:
                return new Fragment1(bitmap);
            case 1:
                return new Fragment2(bitmap);
            case 2:
                return new Fragment3(bitmap);
        }
        return null;
    }

    @Override
    public int getItemCount() {
        return 3;
    }
}
